package com.dy.spring.boot.configration;

import com.rmq.client.RmqClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * todo 初始化检查nameserver是否有效
 */
@Configuration
public class Config {

    @Value("${rocketmq.namesrvAddr}")
    private String namesrvAddr;
    @Value("${rocketmq.producerGroupName}")
    private String producerGroupName;
    @Value("${rocketmq.cosumerGroup}")
    private String cosumerGroup;
    @Value("${rocketmq.topicTags}")
    private String topicTags;

//    @Bean(initMethod = "init")
//    public RmqClient configRocetmqClinet() {
//        RmqClient client = new RmqClient();
//        client.setProducerNamesrvAddr(namesrvAddr);
//        client.setConsumerNamesrvAddr(namesrvAddr);
//        client.setProducerGroupName(producerGroupName);
//        client.setConsumerGroupName(cosumerGroup);
//        client.setConsumerTopicTags(topicTags);
//        client.setMessageListener(listenMessage());
//        return client;
//    }
    @Bean
    public MessageLisener listenMessage() {
        return new MessageLisener();
    }
}
